<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 15-7-20
 * Time: 上午10:16
 */
class LongHuShan{
       public    $user = 'test1';
       public  $pwd = 'jjl4yk11f82ce6c0f33a5c003f2fec56';

    function PFT_Order_Submit($request_array){


        $inSide =new SoapClient("http://open.elonghushan.com.cn/openService/MXSE.wsdl",array('encoding' =>'UTF-8','cache_wsdl' => 0));
        $submit = $inSide->__soapCall("PFT_Order_Submit",array("ac"=>$this->user,"pw"=>$this->pwd,"in0"=>12,"in1"=>43,"in2"=>$request_array['pftordernum'],"in3"=>100,"in4"=>$request_array['UUtnum'],"in5"=>$request_array['UUplaytime'],"in6"=>$request_array['pftordername'],"in7"=>$request_array['UUordertel'],"in8"=>"","in9"=>1,"in10"=>2,"in11"=>0,"in12"=>"","in13"=>0,"in14"=>0,"in15"=>0,"in16"=>1307,"in17"=>$request_array['IDcar']));
//            print_r($submit);
       $response =  simplexml_load_string($submit);
//        echo $response->Rec->UUremotenum;
        if(isset($response->Rec->UUremotenum)&&$response->Rec->UUerrorcode!=1075){
            $UUremotenum =(int)$response->Rec->UUremotenum;
            return $UUremotenum;
        }else{
            logfile($UUremotenum .'fail');
            return 101;

        }


    }
    function Order_Globle_Search($array_id){

        $inSide =new SoapClient("http://open.elonghushan.com.cn/openService/MXSE.wsdl",array('encoding' =>'UTF-8','cache_wsdl' => 0));
        $submit = $inSide->__soapCall("Order_Globle_Search",array("ac"=>$this->user,"pw"=>$this->pwd,"in0"=>'',"in1"=>'',"in2"=>'',"in3"=>'',"in4"=>'',"in5"=>'',"in6"=>'',"in7"=>'',"in8"=>'',
            "in9"=>'',"in10"=>'',"in11"=>'',"in12"=>'',
            "in13"=>(int)$array_id,"in14"=>'',"in15"=>'',"in16"=>'',"in17"=>'',"in18"=>'',"in19"=>'',"in20"=>'',
            "in21"=>'',"in22"=>'',"in23"=>'',"in24"=>'',"in25"=>'',"in26"=>'',));

        $array_xml = simplexml_load_string($submit);


        return $array_xml->Rec->UUordernum;
    }
    function  Order_Change_Pro($arr_refund){
            echo $arr_refund['longhushan_orderid'];

        $inSide =new SoapClient("http://open.elonghushan.com.cn/openService/MXSE.wsdl",array('encoding' =>'UTF-8','cache_wsdl' => 0));
        $submit = $inSide->__soapCall("Order_Change_Pro",array("ac"=>$this->user,"pw"=>$this->pwd,"in0"=>$arr_refund['longhushan_orderid'],"in1"=>$arr_refund['done_num'],"in2"=>''));
        $xml = simplexml_load_string($submit);
//        print_r($xml);
        return $submit;

    }
}
function logfile($txt)
{
    $fp = fopen('longhushan_log.txt', "a");
    flock($fp, LOCK_EX);
    fwrite($fp, $txt . "\n");
    flock($fp, LOCK_UN);
    fclose($fp);
}